package com.xmlt.core.template.tags;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


import ognl.OgnlException;

import org.w3c.dom.Element;

import com.xmlt.core.template.TemplateException;
import com.xmlt.core.template.instance.AbstractInstance;

public abstract class TemplateSectionElement {
	private Map<String, String> paramMap;
	public TemplateSectionElement() {
		paramMap = new HashMap<String, String>();
	}
	
	public void setParameter(String name, Element el) throws TemplateException {
		paramMap.put(name, el.getAttribute("value"));
	}
	
	public void setParameter(String name, String s) {
		paramMap.put(name, s);
	}
	
	protected String getParameterValue(String name) {
		return paramMap.get(name);
	}
	
	public void accept(ITemplateSectionElementVisitor visitor) {
		visitor.visit(this);
	}
	
	public abstract List<TemplateSectionElement> generateTags(AbstractInstance instance) throws OgnlException;
}
